SOURCE_PATH=src
BUILD_PATH=build

#removing builded files
rm -r $BUILD_PATH/*.o
rm -r $BUILD_PATH/*.bin

#compiling boot
gcc -o $BUILD_PATH/boot.o -c $SOURCE_PATH/boot.S -I./$SOURCE_PATH -Wextra -Werror -nostdlib -nostartfiles -nodefaultlibs

#compiling kernel
gcc -o $BUILD_PATH/kernel.o -c $SOURCE_PATH/kernel.c -I./$SOURCE_PATH -std=c99 -Wextra -nostdlib -nostartfiles -nodefaultlibs

#linking files
ld -T $SOURCE_PATH/linker.ld -o $BUILD_PATH/kernel.bin $BUILD_PATH/boot.o $BUILD_PATH/kernel.o

#emulating kernel on QEmu
qemu -kernel $BUILD_PATH/kernel.bin
